//
//  UIImage+Extend.m
//  MobTimes
//
//  Created by 江山 王 on 5/3/12.
//  Copyright (c) 2012 Finalist. All rights reserved.
//

#import "UIImage+Extend.h"

@implementation UIImage(Extend)

+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
    UIGraphicsBeginImageContext(newSize);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();        
    UIGraphicsEndImageContext();
    
    return [newImage retain];
}

- (UIImage *)imageScaledToSize:(CGSize)newSize {
    return [UIImage imageWithImage:self scaledToSize:newSize];
}

@end
